package sk.xorty.si;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import sk.xorty.oxm.Order;

import java.math.BigInteger;
import java.util.Arrays;

@Component
public class OrderMapper implements Mapper {

    protected static Logger logger = Logger.getLogger("integration");

    @Override
    public Object map(String[] content) {
        System.out.println("======== MAPPER INVOKED ========");
        System.out.println("\t=> Mapping this content to Order: " + Arrays.toString(content));

        Order order = new Order();
        order.setId(content[0]);
        order.setBranch(content[1]);
        order.setKeyword(content[2]);
        order.setProduct(content[3]);
        order.setQuantity(BigInteger.valueOf(Long.valueOf(content[4])));

        return order;
    }

}
